package de.jmda.gen.impl;

import static org.junit.Assert.assertTrue;

import org.apache.log4j.Logger;
import org.junit.Test;

import de.jmda.gen.GeneratorException;

public class JUTDefaultCompoundGenerator
{
	private final static Logger LOGGER =
      Logger.getLogger(JUTDefaultCompoundGenerator.class);

	@Test
	public void testDefaultCompoundGenerator() throws GeneratorException
	{
		String input1 = "test1";
		String input2 = "test2";
		String input3 = "test3";

		DefaultCompoundGenerator generator = new DefaultCompoundGenerator();
		
		DefaultGenerator generatorComponent1 = new DefaultGenerator(input1);
		DefaultGenerator generatorComponent2 = new DefaultGenerator(input2);
		DefaultGenerator generatorComponent3 = new DefaultGenerator(input3);
		
		generator.addGeneratorComponent(generatorComponent1);
		generator.addGeneratorComponent(generatorComponent2);
		generator.addGeneratorComponent(generatorComponent3);
//		generator.setComponentSeparator(" ");
		
		StringBuffer generated = generator.generate();
		
		LOGGER.debug("generated [" + generated + "]");

		System.out.println(generator.generate());
		assertTrue(
				"unexpected generated [" + generated + "]",
				(input1 + input2 + input3).contentEquals(generated));
	}
}